home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / windownt / awksrc.zip / GAWK-D~1.14 / GAWK1~1.PR < prev   
Text File  |  1993-10-03  |  46KB  |  1,321 lines

  1.  
  2.  
  3.  
  4. GAWK(1)                 Utility Commands                  GAWK(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      gawk - pattern scanning and processing language
  10.  
  11. SYNOPSIS
  12.      gawk [ -W _g_a_w_k-_o_p_t_i_o_n_s  ]  [  -F_f_s  ]  [  -v  _v_a_r=_v_a_l  ]  -f
  13.      _p_r_o_g_r_a_m-_f_i_l_e [ -- ] file ...
  14.      gawk [ -W _g_a_w_k-_o_p_t_i_o_n_s ] [ -F_f_s ] [ -v  _v_a_r=_v_a_l  ]  [  --  ]
  15.      _p_r_o_g_r_a_m-_t_e_x_t file ...
  16.  
  17. DESCRIPTION
  18.      _G_a_w_k is the GNU Project's implementation of the AWK program-
  19.      ming  language.   It  conforms  to  the  definition  of  the
  20.      language in the POSIX 1003.2 Command Language And  Utilities
  21.      Standard  (draft  11).  This version in turn is based on the
  22.      description in _T_h_e _A_W_K _P_r_o_g_r_a_m_m_i_n_g _L_a_n_g_u_a_g_e,  by  Aho,  Ker-
  23.      nighan, and Weinberger, with the additional features defined
  24.      in the System V Release 4 version of UNIX  _a_w_k.   _G_a_w_k  also
  25.      provides some GNU-specific extensions.
  26.  
  27.      The command line consists of options to _g_a_w_k itself, the AWK
  28.      program text (if not supplied via the -f option), and values
  29.      to be made available in the ARGC and  ARGV  pre-defined  AWK
  30.      variables.
  31.  
  32. OPTIONS
  33.      _G_a_w_k accepts the following options, which should  be  avail-
  34.      able on any implementation of the AWK language.
  35.  
  36.      -F_f_s Use _f_s for the input field separator (the value of  the
  37.           FS predefined variable).
  38.  
  39.      -v _v_a_r=_v_a_l
  40.           Assign the value _v_a_l, to the variable _v_a_r, before  exe-
  41.           cution of the program begins.  Such variable values are
  42.           available to the BEGIN block of an AWK program.
  43.  
  44.      -f _p_r_o_g_r_a_m-_f_i_l_e
  45.           Read the AWK program source from the file _p_r_o_g_r_a_m-_f_i_l_e,
  46.           instead  of from the first command line argument.  Mul-
  47.           tiple -f options may be used.
  48.  
  49.      --   Signal the end of options.  This  is  useful  to  allow
  50.           further  arguments  to  the AWK program itself to start
  51.           with a ``-''.  This is mainly for consistency with  the
  52.           argument  parsing  convention  used by most other POSIX
  53.           programs.
  54.  
  55.      Following the POSIX standard, _g_a_w_k-specific options are sup-
  56.      plied  via  arguments to the -W option.  Multiple -W options
  57.      may be supplied,  or  multiple  arguments  may  be  supplied
  58.      together  if  they  are  separated by commas, or enclosed in
  59.      quotes and separated by white space.   Case  is  ignored  in
  60.  
  61.  
  62.  
  63. Free Software FoundationLast change: Jul 20 1992                   1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GAWK(1)                 Utility Commands                  GAWK(1)
  71.  
  72.  
  73.  
  74.      arguments to the -W option.
  75.  
  76.      The -W option accepts the following arguments:
  77.  
  78.      compat    Run in _c_o_m_p_a_t_i_b_i_l_i_t_y mode.  In compatibility mode,
  79.                _g_a_w_k  behaves identically to UNIX _a_w_k; none of the
  80.                GNU-specific extensions are recognized.   See  GNU
  81.                EXTENSIONS, below, for more information.
  82.  
  83.      copyleft
  84.      copyright Print the  short  version  of  the  GNU  copyright
  85.                information message on the error output.
  86.  
  87.      lint      Provide warnings about constructs that are dubious
  88.                or non-portable to other AWK implementations.
  89.  
  90.      posix     This turns on _c_o_m_p_a_t_i_b_i_l_i_t_y mode, with the follow-
  91.                ing additional restrictions:
  92.  
  93.                o+ \x escape sequences are not recognized.
  94.  
  95.                o+ The synonym func for the keyword function is not
  96.                  recognized.
  97.  
  98.                o+ The operators ** and **= cannot be used in place
  99.                  of ^ and ^=.
  100.  
  101.      version   Print version information for this particular copy
  102.                of  _g_a_w_k  on  the  error  output.   This is useful
  103.                mainly for knowing if the current copy of _g_a_w_k  on
  104.                your system is up to date with respect to whatever
  105.                the Free Software Foundation is distributing.
  106.  
  107.      Any other options are flagged as illegal, but are  otherwise
  108.      ignored.
  109.  
  110. AWK PROGRAM EXECUTION
  111.      An AWK program consists  of  a  sequence  of  pattern-action
  112.      statements and optional function definitions.
  113.  
  114.           _p_a_t_t_e_r_n   { _a_c_t_i_o_n _s_t_a_t_e_m_e_n_t_s }
  115.           function _n_a_m_e(_p_a_r_a_m_e_t_e_r _l_i_s_t) { _s_t_a_t_e_m_e_n_t_s }
  116.  
  117.      _G_a_w_k first reads the program source from the _p_r_o_g_r_a_m-_f_i_l_e(s)
  118.      if  specified,  or from the first non-option argument on the
  119.      command line.  The -f option may be used multiple  times  on
  120.      the command line.  _G_a_w_k will read the program text as if all
  121.      the _p_r_o_g_r_a_m-_f_i_l_es had been concatenated together.   This  is
  122.      useful for building libraries of AWK functions, without hav-
  123.      ing to include them in each new AWK program that uses  them.
  124.      To  use a library function in a file from a program typed in
  125.      on  the  command  line,  specify  /dev/tty  as  one  of  the
  126.  
  127.  
  128.  
  129. Free Software FoundationLast change: Jul 20 1992                   2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GAWK(1)                 Utility Commands                  GAWK(1)
  137.  
  138.  
  139.  
  140.      _p_r_o_g_r_a_m-_f_i_l_es,  type  your  program,  and  end  it with a ^D
  141.      (control-d).
  142.  
  143.      The environment variable AWKPATH specifies a search path  to
  144.      use  when finding source files named with the -f option.  If
  145.      this  variable  does  not  exist,  the   default   path   is
  146.      ".:/usr/lib/awk:/usr/local/lib/awk".   If  a file name given
  147.      to the -f option contains a ``/'' character, no path  search
  148.      is performed.
  149.  
  150.      _G_a_w_k executes AWK programs in the following  order.   First,
  151.      _g_a_w_k  compiles the program into an internal form.  Next, all
  152.      variable assignments specified via the -v  option  are  per-
  153.      formed.   Then, _g_a_w_k executes the code in the BEGIN block(s)
  154.      (if any), and then proceeds to read each file named  in  the
  155.      ARGV  array.   If  there  are  no files named on the command
  156.      line, _g_a_w_k reads the standard input.
  157.  
  158.      If a filename on the command line has the form _v_a_r=_v_a_l it is
  159.      treated  as  a variable assignment. The variable _v_a_r will be
  160.      assigned the value  _v_a_l.   (This  happens  after  any  BEGIN
  161.      block(s) have been run.) Command line variable assignment is
  162.      most useful for dynamically assigning values  to  the  vari-
  163.      ables  AWK  uses  to control how input is broken into fields
  164.      and records. It is also useful for controlling state if mul-
  165.      tiple passes are needed over a single data file.
  166.  
  167.      If the value of a particular element of ARGV is empty  (""),
  168.      _g_a_w_k skips over it.
  169.  
  170.      For each line in the input, _g_a_w_k tests to see if it  matches
  171.      any  _p_a_t_t_e_r_n  in the AWK program.  For each pattern that the
  172.      line matches, the associated _a_c_t_i_o_n is executed.   The  pat-
  173.      terns are tested in the order they occur in the program.
  174.  
  175.      Finally, after all the input is exhausted, _g_a_w_k executes the
  176.      code in the END block(s) (if any).
  177.  
  178. VARIABLES AND FIELDS
  179.      AWK variables are dynamic; they  come  into  existence  when
  180.      they  are first used. Their values are either floating-point
  181.      numbers or strings, or both, depending  upon  how  they  are
  182.      used.  AWK  also  has  one dimension arrays; multiply dimen-
  183.      sioned arrays may be simulated.  Several  pre-defined  vari-
  184.      ables  are set as a program runs; these will be described as
  185.      needed and summarized below.
  186.  
  187.   Fields
  188.      As each input line  is  read,  _g_a_w_k  splits  the  line  into
  189.      _f_i_e_l_d_s,  using  the  value  of  the FS variable as the field
  190.      separator.   If  FS  is  a  single  character,  fields   are
  191.      separated  by  that character.  Otherwise, FS is expected to
  192.  
  193.  
  194.  
  195. Free Software FoundationLast change: Jul 20 1992                   3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. GAWK(1)                 Utility Commands                  GAWK(1)
  203.  
  204.  
  205.  
  206.      be a full regular expression.  In the special case  that  FS
  207.      is  a  single  blank, fields are separated by runs of blanks
  208.      and/or tabs.  Note that the value of IGNORECASE (see  below)
  209.      will  also  affect how fields are split when FS is a regular
  210.      expression.
  211.  
  212.      If the FIELDWIDTHS variable is set to a space separated list
  213.      of  numbers, each field is expected to have fixed width, and
  214.      _g_a_w_k will split up the record using  the  specified  widths.
  215.      The  value  of  FS  is ignored.  Assigning a new value to FS
  216.      overrides the use of FIELDWIDTHS, and restores  the  default
  217.      behavior.
  218.  
  219.      Each field in the input line may be referenced by its  posi-
  220.      tion, $1, $2, and so on.  $0 is the whole line. The value of
  221.      a field may be assigned to as  well.   Fields  need  not  be
  222.      referenced by constants:
  223.  
  224.           n = 5
  225.           print $n
  226.  
  227.      prints the fifth field in the input line.  The  variable  NF
  228.      is set to the total number of fields in the input line.
  229.  
  230.      References to non-existent fields (i.e.  fields  after  $NF)
  231.      produce  the  null-string.  However,  assigning  to  a  non-
  232.      existent field (e.g., $(NF+2) = 5) will increase  the  value
  233.      of NF, create any intervening fields with the null string as
  234.      their value, and cause the value of  $0  to  be  recomputed,
  235.      with the fields being separated by the value of OFS.
  236.  
  237.   Built-in Variables
  238.      AWK's built-in variables are:
  239.  
  240.      ARGC        The number of command line arguments  (does  not
  241.                  include options to _g_a_w_k, or the program source).
  242.  
  243.      ARGV        Array of command line arguments.  The  array  is
  244.                  indexed  from 0 to ARGC - 1.  Dynamically chang-
  245.                  ing the contents of ARGV can control  the  files
  246.                  used for data.
  247.  
  248.      CONVFMT     The conversion format for  numbers,  "%.6g",  by
  249.                  default.
  250.  
  251.      ENVIRON     An array containing the values  of  the  current
  252.                  environment.    The  array  is  indexed  by  the
  253.                  environment variables, each  element  being  the
  254.                  value  of  that  variable (e.g., ENVIRON["HOME"]
  255.                  might be /u/arnold).  Changing this  array  does
  256.                  not  affect  the  environment  seen  by programs
  257.                  which  _g_a_w_k  spawns  via  redirection   or   the
  258.  
  259.  
  260.  
  261. Free Software FoundationLast change: Jul 20 1992                   4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. GAWK(1)                 Utility Commands                  GAWK(1)
  269.  
  270.  
  271.  
  272.                  system() function.  (This may change in a future
  273.                  version of _g_a_w_k.)
  274.  
  275.      FIELDWIDTHS A white-space  separated  list  of  fieldwidths.
  276.                  When  set,  _g_a_w_k parses the input into fields of
  277.                  fixed width, instead of using the value  of  the
  278.                  FS  variable  as the field separator.  The fixed
  279.                  field  width  facility  is  still  experimental;
  280.                  expect  the  semantics to change as _g_a_w_k evolves
  281.                  over time.
  282.  
  283.      FILENAME    The name of the current input file.  If no files
  284.                  are  specified on the command line, the value of
  285.                  FILENAME is ``-''.
  286.  
  287.      FNR         The input record number  in  the  current  input
  288.                  file.
  289.  
  290.      FS          The input field separator, a blank by default.
  291.  
  292.      IGNORECASE  Controls the  case-sensitivity  of  all  regular
  293.                  expression  operations. If IGNORECASE has a non-
  294.                  zero value,  then  pattern  matching  in  rules,
  295.                  field  splitting  with  FS,  regular  expression
  296.                  matching with ~ and !~, and the gsub(), index(),
  297.                  match(),  split(),  and  sub() pre-defined func-
  298.                  tions will all ignore case  when  doing  regular
  299.                  expression  operations.   Thus, if IGNORECASE is
  300.                  not equal to  zero,  /aB/  matches  all  of  the
  301.                  strings "ab", "aB", "Ab", and "AB".  As with all
  302.                  AWK variables, the initial value  of  IGNORECASE
  303.                  is  zero,  so  all regular expression operations
  304.                  are normally case-sensitive.
  305.  
  306.      NF          The  number  of  fields  in  the  current  input
  307.                  record.
  308.  
  309.      NR          The total number of input records seen so far.
  310.  
  311.      OFMT        The  output  format  for  numbers,  "%.6g",   by
  312.                  default.
  313.  
  314.      OFS         The output field separator, a blank by default.
  315.  
  316.      ORS         The output record separator, by default  a  new-
  317.                  line.
  318.  
  319.      RS          The input record separator, by  default  a  new-
  320.                  line.   RS is exceptional in that only the first
  321.                  character  of  its  string  value  is  used  for
  322.                  separating  records.  (This will probably change
  323.                  in a future release of _g_a_w_k.) If RS  is  set  to
  324.  
  325.  
  326.  
  327. Free Software FoundationLast change: Jul 20 1992                   5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. GAWK(1)                 Utility Commands                  GAWK(1)
  335.  
  336.  
  337.  
  338.                  the  null  string, then records are separated by
  339.                  blank lines.  When RS is set to the null string,
  340.                  then  the  newline  character  always  acts as a
  341.                  field separator, in addition to  whatever  value
  342.                  FS may have.
  343.  
  344.      RSTART      The index of  the  first  character  matched  by
  345.                  match(); 0 if no match.
  346.  
  347.      RLENGTH     The length of the string matched by match();  -1
  348.                  if no match.
  349.  
  350.      SUBSEP      The character used  to  separate  multiple  sub-
  351.                  scripts in array elements, by default "\034".
  352.  
  353.   Arrays
  354.      Arrays are subscripted with  an  expression  between  square
  355.      brackets ([ and ]).  If the expression is an expression list
  356.      (_e_x_p_r, _e_x_p_r ...) then the array subscript is a  string  con-
  357.      sisting  of  the concatenation of the (string) value of each
  358.      expression, separated by the value of the  SUBSEP  variable.
  359.      This  facility  is  used  to  simulate  multiply dimensioned
  360.      arrays. For example:
  361.  
  362.           i = "A" ; j = "B" ; k = "C"
  363.           x[i, j, k] = "hello, world\n"
  364.  
  365.      assigns the string "hello, world\n" to the  element  of  the
  366.      array  x  which  is indexed by the string "A\034B\034C". All
  367.      arrays in  AWK  are  associative,  i.e.  indexed  by  string
  368.      values.
  369.  
  370.      The special operator in may be used in an if or while state-
  371.      ment to see if an array has an index consisting of a partic-
  372.      ular value.
  373.  
  374.           if (val in array)
  375.                print array[val]
  376.  
  377.      If the array has multiple subscripts, use (i, j) in array.
  378.  
  379.      The in construct may also be used in a for loop  to  iterate
  380.      over all the elements of an array.
  381.  
  382.      An element may be deleted from an  array  using  the  delete
  383.      statement.
  384.  
  385.   Variable Typing And Conversion
  386.      Variables and fields may be  (floating  point)  numbers,  or
  387.      strings, or both. How the value of a variable is interpreted
  388.      depends upon its context. If used in a  numeric  expression,
  389.      it  will be treated as a number, if used as a string it will
  390.  
  391.  
  392.  
  393. Free Software FoundationLast change: Jul 20 1992                   6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. GAWK(1)                 Utility Commands                  GAWK(1)
  401.  
  402.  
  403.  
  404.      be treated as a string.
  405.  
  406.      To force a variable to be treated as a number, add 0 to  it;
  407.      to  force  it to be treated as a string, concatenate it with
  408.      the null string.
  409.  
  410.      When a string must be converted to a number, the  conversion
  411.      is  accomplished  using _a_t_o_f(3).  A number is converted to a
  412.      string by using the value of CONVFMT as a format string  for
  413.      _s_p_r_i_n_t_f(3),  with  the  numeric value of the variable as the
  414.      argument.  However, even  though  all  numbers  in  AWK  are
  415.      floating-point,  integral  values  are  _a_l_w_a_y_s  converted as
  416.      integers.  Thus, given
  417.  
  418.           CONVFMT = "%2.2f"
  419.           a = 12
  420.           b = a ""
  421.  
  422.      the variable b has a value of "12" and not "12.00".
  423.  
  424.      _G_a_w_k performs comparisons as follows: If two  variables  are
  425.      numeric,  they  are  compared  numerically.  If one value is
  426.      numeric and the other has a string value that is a ``numeric
  427.      string,''  then comparisons are also done numerically.  Oth-
  428.      erwise, the numeric value is converted to  a  string  and  a
  429.      string  comparison  is performed.  Two strings are compared,
  430.      of course, as strings.   According  to  the  POSIX  standard
  431.      (draft  11),  even  if  two  strings  are numeric strings, a
  432.      numeric comparison is performed.  However, this  is  clearly
  433.      incorrect, and _g_a_w_k does not do this.
  434.  
  435.      Uninitialized variables have the numeric  value  0  and  the
  436.      string value "" (the null, or empty, string).
  437.  
  438. PATTERNS AND ACTIONS
  439.      AWK is a line oriented language. The  pattern  comes  first,
  440.      and then the action. Action statements are enclosed in { and
  441.      }.  Either the pattern may be missing, or the action may  be
  442.      missing,  but,  of course, not both. If the pattern is miss-
  443.      ing, the action will be executed for every  single  line  of
  444.      input.  A missing action is equivalent to
  445.  
  446.           { print }
  447.  
  448.      which prints the entire line.
  449.  
  450.      Comments begin with the ``#'' character, and continue  until
  451.      the  end  of  the line.  Blank lines may be used to separate
  452.      statements.  Normally, a statement ends with a newline, how-
  453.      ever,  this  is  not  the  case for lines ending in a ``,'',
  454.      ``{'', ``?'', ``:'', ``&&'', or ``||''.  Lines ending in  do
  455.      or  else  also have their statements automatically continued
  456.  
  457.  
  458.  
  459. Free Software FoundationLast change: Jul 20 1992                   7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. GAWK(1)                 Utility Commands                  GAWK(1)
  467.  
  468.  
  469.  
  470.      on the following line.  In other cases, a line can  be  con-
  471.      tinued  by ending it with a ``\'', in which case the newline
  472.      will be ignored.
  473.  
  474.      Multiple statements may be put on  one  line  by  separating
  475.      them  with  a  ``;''.   This  applies to both the statements
  476.      within the action part of a pattern-action pair  (the  usual
  477.      case), and to the pattern-action statements themselves.
  478.  
  479.   Patterns
  480.      AWK patterns may be one of the following:
  481.  
  482.           BEGIN
  483.           END
  484.           /_r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n/
  485.           _r_e_l_a_t_i_o_n_a_l _e_x_p_r_e_s_s_i_o_n
  486.           _p_a_t_t_e_r_n && _p_a_t_t_e_r_n
  487.           _p_a_t_t_e_r_n || _p_a_t_t_e_r_n
  488.           _p_a_t_t_e_r_n ? _p_a_t_t_e_r_n : _p_a_t_t_e_r_n
  489.           (_p_a_t_t_e_r_n)
  490.           ! _p_a_t_t_e_r_n
  491.           _p_a_t_t_e_r_n_1, _p_a_t_t_e_r_n_2
  492.  
  493.      BEGIN and END are two special kinds of  patterns  which  are
  494.      not tested against the input.  The action parts of all BEGIN
  495.      patterns are merged as if all the statements had been  writ-
  496.      ten in a single BEGIN block. They are executed before any of
  497.      the input is read. Similarly, all the END blocks are merged,
  498.      and  executed  when  all  the input is exhausted (or when an
  499.      exit statement is executed).  BEGIN and END patterns  cannot
  500.      be  combined  with  other  patterns  in pattern expressions.
  501.      BEGIN and END patterns cannot have missing action parts.
  502.  
  503.      For /_r_e_g_u_l_a_r _e_x_p_r_e_s_s_i_o_n/ patterns, the associated  statement
  504.      is  executed  for  each  input line that matches the regular
  505.      expression.  Regular expressions are the same  as  those  in
  506.      _e_g_r_e_p(1), and are summarized below.
  507.  
  508.      A _r_e_l_a_t_i_o_n_a_l _e_x_p_r_e_s_s_i_o_n may use any of the operators defined
  509.      below  in  the  section  on  actions.   These generally test
  510.      whether certain fields match certain regular expressions.
  511.  
  512.      The &&, ||, and ! operators are logical AND, logical OR, and
  513.      logical  NOT,  respectively, as in C.  They do short-circuit
  514.      evaluation, also as in C, and are used  for  combining  more
  515.      primitive   pattern   expressions.  As  in  most  languages,
  516.      parentheses may be used to change the order of evaluation.
  517.  
  518.      The ?: operator is like the same operator in C. If the first
  519.      pattern  is  true  then  the pattern used for testing is the
  520.      second pattern, otherwise it is the third. Only one  of  the
  521.      second and third patterns is evaluated.
  522.  
  523.  
  524.  
  525. Free Software FoundationLast change: Jul 20 1992                   8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. GAWK(1)                 Utility Commands                  GAWK(1)
  533.  
  534.  
  535.  
  536.      The _p_a_t_t_e_r_n_1, _p_a_t_t_e_r_n_2 form of an  expression  is  called  a
  537.      range pattern.  It matches all input records starting with a
  538.      line that matches _p_a_t_t_e_r_n_1, and continuing  until  a  record
  539.      that  matches  _p_a_t_t_e_r_n_2, inclusive. It does not combine with
  540.      any other sort of pattern expression.
  541.  
  542.   Regular Expressions
  543.      Regular expressions are the extended kind  found  in  _e_g_r_e_p.
  544.      They are composed of characters as follows:
  545.  
  546.      _c          matches the non-metacharacter _c.
  547.  
  548.      _\_c         matches the literal character _c.
  549.  
  550.      .          matches any character except newline.
  551.  
  552.      ^          matches the beginning of a line or a string.
  553.  
  554.      $          matches the end of a line or a string.
  555.  
  556.      [_a_b_c...]   character class, matches any  of  the  characters
  557.                 _a_b_c....
  558.  
  559.      [^_a_b_c...]  negated character class,  matches  any  character
  560.                 except _a_b_c... and newline.
  561.  
  562.      _r_1|_r_2      alternation: matches either _r_1 or _r_2.
  563.  
  564.      _r_1_r_2       concatenation: matches _r_1, and then _r_2.
  565.  
  566.      _r+         matches one or more _r's.
  567.  
  568.      _r*         matches zero or more _r's.
  569.  
  570.      _r?         matches zero or one _r's.
  571.  
  572.      (_r)        grouping: matches _r.
  573.  
  574.      The escape sequences that are valid in string constants (see
  575.      below) are also legal in regular expressions.
  576.  
  577.   Actions
  578.      Action statements are enclosed in braces, { and  }.   Action
  579.      statements consist of the usual assignment, conditional, and
  580.      looping statements found in most languages.  The  operators,
  581.      control  statements,  and  input/output statements available
  582.      are patterned after those in C.
  583.  
  584.   Operators
  585.      The operators in AWK, in order of increasing precedence, are
  586.  
  587.  
  588.  
  589.  
  590.  
  591. Free Software FoundationLast change: Jul 20 1992                   9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. GAWK(1)                 Utility Commands                  GAWK(1)
  599.  
  600.  
  601.  
  602.      = += -=
  603.      *= /= %= ^= Assignment.  Both  absolute  assignment  (_v_a_r  =
  604.                  _v_a_l_u_e) and operator-assignment (the other forms)
  605.                  are supported.
  606.  
  607.      ?:          The C conditional expression. This has the  form
  608.                  _e_x_p_r_1  ?  _e_x_p_r_2  :  _e_x_p_r_3. If _e_x_p_r_1 is true, the
  609.                  value of the expression is _e_x_p_r_2,  otherwise  it
  610.                  is  _e_x_p_r_3.   Only  one  of  _e_x_p_r_2  and  _e_x_p_r_3 is
  611.                  evaluated.
  612.  
  613.      ||          Logical OR.
  614.  
  615.      &&          Logical AND.
  616.  
  617.      ~ !~        Regular expression match, negated match.   NOTE:
  618.                  Do not use a constant regular expression (/foo/)
  619.                  on the left-hand side of a ~ or  !~.   Only  use
  620.                  one  on  the  right-hand  side.   The expression
  621.                  /foo/ ~ _e_x_p has  the  same  meaning  as  (($0  ~
  622.                  /foo/)  ~  _e_x_p).   This  is usually _n_o_t what was
  623.                  intended.
  624.  
  625.      < >
  626.      <= >=
  627.      != ==       The regular relational operators.
  628.  
  629.      _b_l_a_n_k       String concatenation.
  630.  
  631.      + -         Addition and subtraction.
  632.  
  633.      * / %       Multiplication, division, and modulus.
  634.  
  635.      + - !       Unary plus, unary minus, and logical negation.
  636.  
  637.      ^           Exponentiation (** may also be used, and **= for
  638.                  the assignment operator).
  639.  
  640.      ++ --       Increment and decrement, both prefix  and  post-
  641.                  fix.
  642.  
  643.      $           Field reference.
  644.  
  645.   Control Statements
  646.      The control statements are as follows:
  647.  
  648.           if (_c_o_n_d_i_t_i_o_n) _s_t_a_t_e_m_e_n_t [ else _s_t_a_t_e_m_e_n_t ]
  649.           while (_c_o_n_d_i_t_i_o_n) _s_t_a_t_e_m_e_n_t
  650.           do _s_t_a_t_e_m_e_n_t while (_c_o_n_d_i_t_i_o_n)
  651.           for (_e_x_p_r_1; _e_x_p_r_2; _e_x_p_r_3) _s_t_a_t_e_m_e_n_t
  652.           for (_v_a_r in _a_r_r_a_y) _s_t_a_t_e_m_e_n_t
  653.           break
  654.  
  655.  
  656.  
  657. Free Software FoundationLast change: Jul 20 1992                  10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. GAWK(1)                 Utility Commands                  GAWK(1)
  665.  
  666.  
  667.  
  668.           continue
  669.           delete _a_r_r_a_y[_i_n_d_e_x]
  670.           exit [ _e_x_p_r_e_s_s_i_o_n ]
  671.           { _s_t_a_t_e_m_e_n_t_s }
  672.  
  673.   I/O Statements
  674.      The input/output statements are as follows:
  675.  
  676.      close(_f_i_l_e_n_a_m_e)       Close file (or pipe, see below).
  677.  
  678.      getline               Set $0 from next input record; set NF,
  679.                            NR, FNR.
  680.  
  681.      getline <_f_i_l_e         Set $0 from next record of  _f_i_l_e;  set
  682.                            NF.
  683.  
  684.      getline _v_a_r           Set _v_a_r from next  input  record;  set
  685.                            NF, FNR.
  686.  
  687.      getline _v_a_r <_f_i_l_e     Set _v_a_r from next record of _f_i_l_e.
  688.  
  689.      next                  Stop  processing  the  current   input
  690.                            record.  The next input record is read
  691.                            and processing starts  over  with  the
  692.                            first  pattern  in the AWK program. If
  693.                            the end of the input data is  reached,
  694.                            the  END  block(s),  if  any, are exe-
  695.                            cuted.
  696.  
  697.      next file             Stop  processing  the  current   input
  698.                            file.   The  next  input  record  read
  699.                            comes  from  the  next   input   file.
  700.                            FILENAME  is  updated, FNR is reset to
  701.                            1, and processing starts over with the
  702.                            first  pattern  in the AWK program. If
  703.                            the end of the input data is  reached,
  704.                            the  END  block(s),  if  any, are exe-
  705.                            cuted.
  706.  
  707.      print                 Prints the current record.
  708.  
  709.      print _e_x_p_r-_l_i_s_t       Prints expressions.
  710.  
  711.      print _e_x_p_r-_l_i_s_t >_f_i_l_e Prints expressions on _f_i_l_e.
  712.  
  713.      printf _f_m_t, _e_x_p_r-_l_i_s_t Format and print.
  714.  
  715.      printf _f_m_t, _e_x_p_r-_l_i_s_t >_f_i_l_e
  716.                            Format and print on _f_i_l_e.
  717.  
  718.      system(_c_m_d-_l_i_n_e)      Execute  the  command  _c_m_d-_l_i_n_e,   and
  719.                            return the exit status.  (This may not
  720.  
  721.  
  722.  
  723. Free Software FoundationLast change: Jul 20 1992                  11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. GAWK(1)                 Utility Commands                  GAWK(1)
  731.  
  732.  
  733.  
  734.                            be available on non-POSIX systems.)
  735.  
  736.      Other input/output redirections are also allowed. For  print
  737.      and  printf, >>_f_i_l_e appends output to the _f_i_l_e, while | _c_o_m_-
  738.      _m_a_n_d writes on a pipe.  In a similar fashion, _c_o_m_m_a_n_d | get-
  739.      line  pipes  into  getline.  Getline will return 0 on end of
  740.      file, and -1 on an error.
  741.  
  742.   The _p_r_i_n_t_f Statement
  743.      The AWK versions of the printf statement and sprintf() func-
  744.      tion  (see below) accept the following conversion specifica-
  745.      tion formats:
  746.  
  747.      %c   An ASCII character.  If the argument  used  for  %c  is
  748.           numeric,  it  is  treated  as  a character and printed.
  749.           Otherwise, the argument is assumed to be a string,  and
  750.           the only first character of that string is printed.
  751.  
  752.      %d   A decimal number (the integer part).
  753.  
  754.      %i   Just like %d.
  755.  
  756.      %e   A floating point number of the form [-]d.ddddddE[+-]dd.
  757.  
  758.      %f   A floating point number of the form [-]ddd.dddddd.
  759.  
  760.      %g   Use e or f conversion, whichever is shorter, with  non-
  761.           significant zeros suppressed.
  762.  
  763.      %o   An unsigned octal number (again, an integer).
  764.  
  765.      %s   A character string.
  766.  
  767.      %x   An unsigned hexadecimal number (an integer).
  768.  
  769.      %X   Like %x, but using ABCDEF instead of abcdef.
  770.  
  771.      %%   A single % character; no argument is converted.
  772.  
  773.      There are  optional,  additional  parameters  that  may  lie
  774.      between the % and the control letter:
  775.  
  776.      -    The expression  should  be  left-justified  within  its
  777.           field.
  778.  
  779.      _w_i_d_t_h
  780.           The field should be padded to this width. If the number
  781.           has  a leading zero, then the field will be padded with
  782.           zeros.  Otherwise it is padded with blanks.
  783.  
  784.      ._p_r_e_c
  785.           A number indicating the maximum  width  of  strings  or
  786.  
  787.  
  788.  
  789. Free Software FoundationLast change: Jul 20 1992                  12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. GAWK(1)                 Utility Commands                  GAWK(1)
  797.  
  798.  
  799.  
  800.           digits to the right of the decimal point.
  801.  
  802.      The dynamic _w_i_d_t_h  and  _p_r_e_c  capabilities  of  the  ANSI  C
  803.      printf() routines are supported.  A * in place of either the
  804.      width or prec specifications will cause their values  to  be
  805.      taken from the argument list to printf or sprintf().
  806.  
  807.   Special File Names
  808.      When doing I/O redirection from either print or printf  into
  809.      a  file, or via getline from a file, _g_a_w_k recognizes certain
  810.      special filenames internally.  These filenames allow  access
  811.      to  open  file descriptors inherited from _g_a_w_k's parent pro-
  812.      cess (usually the shell).  The filenames are:
  813.  
  814.      /dev/stdin  The standard input.
  815.  
  816.      /dev/stdout The standard output.
  817.  
  818.      /dev/stderr The standard error output.
  819.  
  820.      /dev/fd/_n   The file associated with the open file  descrip-
  821.                  tor _n.
  822.  
  823.      These are particularly useful for error messages. For  exam-
  824.      ple:
  825.  
  826.           print "You blew it!" > "/dev/stderr"
  827.  
  828.      whereas you would otherwise have to use
  829.  
  830.           print "You blew it!" | "cat 1>&2"
  831.  
  832.      These file names may also be used on  the  command  line  to
  833.      name data files.
  834.  
  835.   Numeric Functions
  836.      AWK has the following pre-defined arithmetic functions:
  837.  
  838.      atan2(_y, _x) returns the arctangent of _y/_x in radians.
  839.  
  840.      cos(_e_x_p_r)   returns the cosine in radians.
  841.  
  842.      exp(_e_x_p_r)   the exponential function.
  843.  
  844.      int(_e_x_p_r)   truncates to integer.
  845.  
  846.      log(_e_x_p_r)   the natural logarithm function.
  847.  
  848.      rand()      returns a random number between 0 and 1.
  849.  
  850.      sin(_e_x_p_r)   returns the sine in radians.
  851.  
  852.  
  853.  
  854.  
  855. Free Software FoundationLast change: Jul 20 1992                  13
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. GAWK(1)                 Utility Commands                  GAWK(1)
  863.  
  864.  
  865.  
  866.      sqrt(_e_x_p_r)  the square root function.
  867.  
  868.      srand(_e_x_p_r) use _e_x_p_r as a new seed  for  the  random  number
  869.                  generator.  If  no _e_x_p_r is provided, the time of
  870.                  day will be used.  The return value is the  pre-
  871.                  vious seed for the random number generator.
  872.  
  873.   String Functions
  874.      AWK has the following pre-defined string functions:
  875.  
  876.      gsub(_r, _s, _t)           for each substring matching the reg-
  877.                              ular  expression  _r in the string _t,
  878.                              substitute the string _s, and  return
  879.                              the  number  of substitutions.  If _t
  880.                              is not supplied, use $0.
  881.  
  882.      index(_s, _t)             returns the index of the string _t in
  883.                              the  string  _s,  or  0  if  _t is not
  884.                              present.
  885.  
  886.      length(_s)               returns the length of the string  _s,
  887.                              or the length of $0 if _s is not sup-
  888.                              plied.
  889.  
  890.      match(_s, _r)             returns the position in _s where  the
  891.                              regular expression _r occurs, or 0 if
  892.                              _r  is  not  present,  and  sets  the
  893.                              values of RSTART and RLENGTH.
  894.  
  895.      split(_s, _a, _r)          splits the string _s into the array _a
  896.                              on  the  regular  expression  _r, and
  897.                              returns the number of fields.  If  _r
  898.                              is omitted, FS is used instead.
  899.  
  900.      sprintf(_f_m_t, _e_x_p_r-_l_i_s_t) prints _e_x_p_r-_l_i_s_t according  to  _f_m_t,
  901.                              and returns the resulting string.
  902.  
  903.      sub(_r, _s, _t)            just like gsub(), but only the first
  904.                              matching substring is replaced.
  905.  
  906.      substr(_s, _i, _n)         returns the _n-character substring of
  907.                              _s  starting  at _i.  If _n is omitted,
  908.                              the rest of _s is used.
  909.  
  910.      tolower(_s_t_r)            returns a copy of  the  string  _s_t_r,
  911.                              with  all  the upper-case characters
  912.                              in   _s_t_r   translated    to    their
  913.                              corresponding   lower-case  counter-
  914.                              parts.   Non-alphabetic   characters
  915.                              are left unchanged.
  916.  
  917.      toupper(_s_t_r)            returns a copy of  the  string  _s_t_r,
  918.  
  919.  
  920.  
  921. Free Software FoundationLast change: Jul 20 1992                  14
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. GAWK(1)                 Utility Commands                  GAWK(1)
  929.  
  930.  
  931.  
  932.                              with  all  the lower-case characters
  933.                              in   _s_t_r   translated    to    their
  934.                              corresponding   upper-case  counter-
  935.                              parts.   Non-alphabetic   characters
  936.                              are left unchanged.
  937.  
  938.   Time Functions
  939.      Since one of the primary uses of AWK programs is  processing
  940.      log files that contain time stamp information, _g_a_w_k provides
  941.      the following two functions for obtaining  time  stamps  and
  942.      formatting them.
  943.  
  944.      systime() returns the current time of day as the  number  of
  945.                seconds  since the Epoch (Midnight UTC, January 1,
  946.                1970 on POSIX systems).
  947.  
  948.      strftime(_f_o_r_m_a_t, _t_i_m_e_s_t_a_m_p)
  949.                formats _t_i_m_e_s_t_a_m_p according to  the  specification
  950.                in  _f_o_r_m_a_t.   The  _t_i_m_e_s_t_a_m_p should be of the same
  951.                form as returned by systime().   If  _t_i_m_e_s_t_a_m_p  is
  952.                missing, the current time of day is used.  See the
  953.                specification for the strftime() function in  ANSI
  954.                C  for  the format conversions that are guaranteed
  955.                to  be  available.   A  public-domain  version  of
  956.                _s_t_r_f_t_i_m_e(3) and a man page for it are shipped with
  957.                _g_a_w_k; if that version was used to build _g_a_w_k, then
  958.                all  of the conversions described in that man page
  959.                are available to _g_a_w_k.
  960.  
  961.   String Constants
  962.      String constants in AWK are sequences of characters enclosed
  963.      between  double  quotes  ("). Within strings, certain _e_s_c_a_p_e
  964.      _s_e_q_u_e_n_c_e_s are recognized, as in C. These are:
  965.  
  966.      \\   A literal backslash.
  967.  
  968.      \a   The ``alert'' character; usually the ASCII BEL  charac-
  969.           ter.
  970.  
  971.      \b   backspace.
  972.  
  973.      \f   form-feed.
  974.  
  975.      \n   new line.
  976.  
  977.      \r   carriage return.
  978.  
  979.      \t   horizontal tab.
  980.  
  981.      \v   vertical tab.
  982.  
  983.      \x_h_e_x _d_i_g_i_t_s
  984.  
  985.  
  986.  
  987. Free Software FoundationLast change: Jul 20 1992                  15
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. GAWK(1)                 Utility Commands                  GAWK(1)
  995.  
  996.  
  997.  
  998.           The character represented by the string of  hexadecimal
  999.           digits  following  the \x.  As in ANSI C, all following
  1000.           hexadecimal digits are considered part  of  the  escape
  1001.           sequence.  (This feature should tell us something about
  1002.           language design by  committee.)  E.g.,  "\x1B"  is  the
  1003.           ASCII ESC (escape) character.
  1004.  
  1005.      \_d_d_d The character represented by the  1-,  2-,  or  3-digit
  1006.           sequence  of octal digits. E.g. "\033" is the ASCII ESC
  1007.           (escape) character.
  1008.  
  1009.      \_c   The literal character _c.
  1010.  
  1011.      The escape sequences may also be used inside constant  regu-
  1012.      lar  expressions  (e.g.,  /[ \t\f\n\r\v]/ matches whitespace
  1013.      characters).
  1014.  
  1015. FUNCTIONS
  1016.      Functions in AWK are defined as follows:
  1017.  
  1018.           function _n_a_m_e(_p_a_r_a_m_e_t_e_r _l_i_s_t) { _s_t_a_t_e_m_e_n_t_s }
  1019.  
  1020.      Functions are executed when called from  within  the  action
  1021.      parts  of  regular pattern-action statements. Actual parame-
  1022.      ters supplied in the function call are used  to  instantiate
  1023.      the  formal parameters declared in the function.  Arrays are
  1024.      passed by reference, other variables are passed by value.
  1025.  
  1026.      Since  functions  were  not  originally  part  of  the   AWK
  1027.      language,  the  provision  for  local  variables  is  rather
  1028.      clumsy: They are declared as extra parameters in the parame-
  1029.      ter list. The convention is to separate local variables from
  1030.      real parameters by extra spaces in the parameter  list.  For
  1031.      example:
  1032.  
  1033.           function  f(p, q,     a, b) { # a & b are local
  1034.                          ..... }
  1035.  
  1036.           /abc/     { ... ; f(1, 2) ; ... }
  1037.  
  1038.      The left parenthesis in  a  function  call  is  required  to
  1039.      immediately  follow the function name, without any interven-
  1040.      ing white space.  This is to  avoid  a  syntactic  ambiguity
  1041.      with  the concatenation operator.  This restriction does not
  1042.      apply to the built-in functions listed above.
  1043.  
  1044.      Functions may call each other and may be  recursive.   Func-
  1045.      tion  parameters  used as local variables are initialized to
  1046.      the null string and the number zero  upon  function  invoca-
  1047.      tion.
  1048.  
  1049.  
  1050.  
  1051.  
  1052.  
  1053. Free Software FoundationLast change: Jul 20 1992                  16
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. GAWK(1)                 Utility Commands                  GAWK(1)
  1061.  
  1062.  
  1063.  
  1064.      The word func may be used in place of function.
  1065.  
  1066. EXAMPLES
  1067.      Print and sort the login names of all users:
  1068.  
  1069.           BEGIN     { FS = ":" }
  1070.                { print $1 | "sort" }
  1071.  
  1072.      Count lines in a file:
  1073.  
  1074.                { nlines++ }
  1075.           END  { print nlines }
  1076.  
  1077.      Precede each line by its number in the file:
  1078.  
  1079.           { print FNR, $0 }
  1080.  
  1081.      Concatenate and line number (a variation on a theme):
  1082.  
  1083.           { print NR, $0 }
  1084.  
  1085. SEE ALSO
  1086.      _e_g_r_e_p(1)
  1087.  
  1088.      _T_h_e _A_W_K _P_r_o_g_r_a_m_m_i_n_g _L_a_n_g_u_a_g_e, Alfred V. Aho, Brian  W.  Ker-
  1089.      nighan,  Peter  J. Weinberger, Addison-Wesley, 1988. ISBN 0-
  1090.      201-07981-X.
  1091.  
  1092.      _T_h_e  _G_A_W_K  _M_a_n_u_a_l,  Edition  0.14,  published  by  the  Free
  1093.      Software Foundation, 1992.
  1094.  
  1095. POSIX COMPATIBILITY
  1096.      A primary goal for _g_a_w_k  is  compatibility  with  the  POSIX
  1097.      standard,  as  well  as with the latest version of UNIX _a_w_k.
  1098.      To this end, _g_a_w_k incorporates the  following  user  visible
  1099.      features  which  are  not described in the AWK book, but are
  1100.      part of _a_w_k in System V Release 4,  and  are  in  the  POSIX
  1101.      standard.
  1102.  
  1103.      The -v option for assigning variables before program  execu-
  1104.      tion  starts  is  new.  The book indicates that command line
  1105.      variable assignment happens when _a_w_k  would  otherwise  open
  1106.      the  argument  as  a file, which is after the BEGIN block is
  1107.      executed.  However, in earlier implementations, when such an
  1108.      assignment  appeared  before  any file names, the assignment
  1109.      would happen _b_e_f_o_r_e the BEGIN block was  run.   Applications
  1110.      came  to depend on this ``feature.'' When _a_w_k was changed to
  1111.      match its documentation, this option was added to accomodate
  1112.      applications  that  depended  upon  the old behavior.  (This
  1113.      feature was agreed upon by both the AT&T  and  GNU  develop-
  1114.      ers.)
  1115.  
  1116.  
  1117.  
  1118.  
  1119. Free Software FoundationLast change: Jul 20 1992                  17
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. GAWK(1)                 Utility Commands                  GAWK(1)
  1127.  
  1128.  
  1129.  
  1130.      The -W option for implementation specific features  is  from
  1131.      the POSIX standard.
  1132.  
  1133.      When processing arguments,  _g_a_w_k  uses  the  special  option
  1134.      ``--''  to signal the end of arguments, and warns about, but
  1135.      otherwise ignores, undefined options.
  1136.  
  1137.      The AWK book does not define the return  value  of  srand().
  1138.      The  System  V  Release 4 version of UNIX _a_w_k (and the POSIX
  1139.      standard) has it return the seed  it  was  using,  to  allow
  1140.      keeping  track of random number sequences. Therefore srand()
  1141.      in _g_a_w_k also returns its current seed.
  1142.  
  1143.      Other new features are: The use of multiple -f options (from
  1144.      MKS _a_w_k); the ENVIRON array; the \a, and \v escape sequences
  1145.      (done originally in _g_a_w_k and  fed  back  into  AT&T's);  the
  1146.      tolower()  and toupper() built-in functions (from AT&T); and
  1147.      the ANSI C conversion specifications in printf  (done  first
  1148.      in AT&T's version).
  1149.  
  1150. GNU EXTENSIONS
  1151.      _G_a_w_k has some extensions to POSIX _a_w_k.  They  are  described
  1152.      in  this  section.  All the extensions described here can be
  1153.      disabled by invoking _g_a_w_k with the -W compat option.
  1154.  
  1155.      The following features of _g_a_w_k are not  available  in  POSIX
  1156.      _a_w_k.
  1157.  
  1158.           o+ The \x escape sequence.
  1159.  
  1160.           o+ The systime() and strftime() functions.
  1161.  
  1162.           o+ The special file names available for I/O  redirection
  1163.             are not recognized.
  1164.  
  1165.           o+ The IGNORECASE variable and its side-effects are  not
  1166.             available.
  1167.  
  1168.           o+ The FIELDWIDTHS variable and fixed width field split-
  1169.             ting.
  1170.  
  1171.           o+ No path search is performed for files named  via  the
  1172.             -f  option.   Therefore the AWKPATH environment vari-
  1173.             able is not special.
  1174.  
  1175.           o+ The use of next file to  abandon  processing  of  the
  1176.             current input file.
  1177.  
  1178.      The AWK book does not define the return value of the close()
  1179.      function.   _G_a_w_k's close() returns the value from _f_c_l_o_s_e(3),
  1180.      or _p_c_l_o_s_e(3), when closing a file or pipe, respectively.
  1181.  
  1182.  
  1183.  
  1184.  
  1185. Free Software FoundationLast change: Jul 20 1992                  18
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. GAWK(1)                 Utility Commands                  GAWK(1)
  1193.  
  1194.  
  1195.  
  1196.      When _g_a_w_k is invoked with the -W compat option,  if  the  _f_s
  1197.      argument  to  the -F option is ``t'', then FS will be set to
  1198.      the tab character.  Since this  is  a  rather  ugly  special
  1199.      case,  it  is  not the default behavior.  This behavior also
  1200.      does not occur if -Wposix has been specified.
  1201.  
  1202. HISTORICAL FEATURES
  1203.      There are two features  of  historical  AWK  implementations
  1204.      that  _g_a_w_k  supports.   First,  it  is  possible to call the
  1205.      length() built-in function not only with  no  argument,  but
  1206.      even without parentheses!  Thus,
  1207.  
  1208.           a = length
  1209.  
  1210.      is the same as either of
  1211.  
  1212.           a = length()
  1213.           a = length($0)
  1214.  
  1215.      This feature is marked as ``deprecated'' in the POSIX  stan-
  1216.      dard,  and _g_a_w_k will issue a warning about its use if -Wlint
  1217.      is specified on the command line.
  1218.  
  1219.      The other feature is the use of the continue statement  out-
  1220.      side  the body of a while, for, or do loop.  Traditional AWK
  1221.      implementations have treated such usage as equivalent to the
  1222.      next statement.  _G_a_w_k will support this usage if -Wposix has
  1223.      not been specified.
  1224.  
  1225. BUGS
  1226.      The -F option is not necessary given the command line  vari-
  1227.      able  assignment feature; it remains only for backwards com-
  1228.      patibility.
  1229.  
  1230. VERSION INFORMATION
  1231.      This man page documents _g_a_w_k, version 2.14.
  1232.  
  1233.      For the 2.14 version of _g_a_w_k, the -c, -V,  -C,  -a,  and  -e
  1234.      options  of  the 2.11 version are recognized.  However, _g_a_w_k
  1235.      will print a warning message, and these options will go away
  1236.      in the 2.15 version.
  1237.  
  1238. AUTHORS
  1239.      The original version of UNIX _a_w_k  was  designed  and  imple-
  1240.      mented  by Alfred Aho, Peter Weinberger, and Brian Kernighan
  1241.      of AT&T Bell Labs. Brian Kernighan continues to maintain and
  1242.      enhance it.
  1243.  
  1244.      Paul Rubin and Jay Fenlason, of the  Free  Software  Founda-
  1245.      tion, wrote _g_a_w_k, to be compatible with the original version
  1246.      of _a_w_k distributed in Seventh Edition UNIX.  John Woods con-
  1247.      tributed  a  number  of  bug  fixes.   David  Trueman,  with
  1248.  
  1249.  
  1250.  
  1251. Free Software FoundationLast change: Jul 20 1992                  19
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. GAWK(1)                 Utility Commands                  GAWK(1)
  1259.  
  1260.  
  1261.  
  1262.      contributions from Arnold Robbins, made _g_a_w_k compatible with
  1263.      the new version of UNIX _a_w_k.
  1264.  
  1265.      The initial DOS port was done by Conrad Kwok and Scott  Gar-
  1266.      finkle.   Scott  Deifik  is the current DOS maintainer.  Pat
  1267.      Rankin did the port to VMS, and Michal  Jaegermann  did  the
  1268.      port to the Atari ST.
  1269.  
  1270. ACKNOWLEDGEMENTS
  1271.      Brian Kernighan of Bell Labs  provided  valuable  assistance
  1272.      during testing and debugging.  We thank him.
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.  
  1284.  
  1285.  
  1286.  
  1287.  
  1288.  
  1289.  
  1290.  
  1291.  
  1292.  
  1293.  
  1294.  
  1295.  
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317. Free Software FoundationLast change: Jul 20 1992                  20
  1318.  
  1319.  
  1320.  
  1321.